Specify a secondary axis

您所在的位置:网站首页 a axis Specify a secondary axis

Specify a secondary axis

2023-03-15 07:10| 来源: 网络整理| 查看: 265

Specify a secondary axis Source: R/axis-secondary.R sec_axis.Rd

This function is used in conjunction with a position scale to create a secondary axis, positioned opposite of the primary axis. All secondary axes must be based on a one-to-one transformation of the primary axes.

Usage sec_axis( trans = NULL, name = waiver(), breaks = waiver(), labels = waiver(), guide = waiver() ) dup_axis( trans = ~., name = derive(), breaks = derive(), labels = derive(), guide = derive() ) derive() Arguments trans

A formula or function of transformation

name

The name of the secondary axis

breaks

One of:

NULL for no breaks

waiver() for the default breaks computed by the transformation object

A numeric vector of positions

A function that takes the limits as input and returns breaks as output

labels

One of:

NULL for no labels

waiver() for the default labels computed by the transformation object

A character vector giving labels (must be same length as breaks)

A function that takes the breaks as input and returns labels as output

guide

A position guide that will be used to render the axis on the plot. Usually this is guide_axis().

Details

sec_axis() is used to create the specifications for a secondary axis. Except for the trans argument any of the arguments can be set to derive() which would result in the secondary axis inheriting the settings from the primary axis.

dup_axis() is provide as a shorthand for creating a secondary axis that is a duplication of the primary axis, effectively mirroring the primary axis.

As of v3.1, date and datetime scales have limited secondary axis capabilities. Unlike other continuous scales, secondary axis transformations for date and datetime scales must respect their primary POSIX data structure. This means they may only be transformed via addition or subtraction, e.g. ~ . + hms::hms(days = 8), or ~ . - 8*60*60. Nonlinear transformations will return an error. To produce a time-since-event secondary axis in this context, users may consider adapting secondary axis labels.

Examples p


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3